package com.panshi.modules.service.impl;

import com.panshi.po.Article;
import com.panshi.po.Search;
import com.panshi.po.Shox;
import com.panshi.modules.mapper.ISearchDao;
import com.panshi.modules.service.ISearchService;
import com.panshi.vo.SearchQueryVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Set;

@Service
@Slf4j
public class SearchServiceImpl implements ISearchService {

    @Autowired
    private ISearchDao searchDao;

    @Resource
    private RedisTemplate<String,Object> redisTemplate;



    @Override
    public Set<Article> findSou() {
        return searchDao.findSou();
    }

    @Override
    public Integer toTotal(SearchQueryVO searchQueryVO) {
        return searchDao.findAll(searchQueryVO);
    }

    @Override
    @Cacheable(value="hasbei:search:")
    public Set<Search> fenye(SearchQueryVO searchQueryVO) {
        return searchDao.fenye(searchQueryVO);
    }

    @Override
    public Set<Shox> tian(int page2) {
        return searchDao.tian(page2);
    }

    @Override
    public Set<Shox> tian1(int page2) {
        return searchDao.tian1(page2);
    }

    @Override
    public Set<Shox> tian2(int page2) {
        return searchDao.tian2(page2);
    }


}
